package com.springbootblog.dao;

import com.springbootblog.dao.sqlBuilder.UserSqlBuilder;
import com.springbootblog.pojo.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserDao
{
    @SelectProvider(type = UserSqlBuilder.class, method = "getUserByEmail")
    User getUserByEmail(@Param("email") String email);

    @SelectProvider(type = UserSqlBuilder.class, method = "getUserInfoById")
    User getUserInfoById(@Param("id") String id);

    @InsertProvider(type = UserSqlBuilder.class, method = "addUser")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    Integer addUser(User user);

    @UpdateProvider(type = UserSqlBuilder.class, method = "updateUserPassword")
    Integer updateUserPassword(String password,String email);

    @UpdateProvider(type = UserSqlBuilder.class, method = "updateUserKey")
    Integer updateUserKey(String user_login_key,String email);

    @UpdateProvider(type = UserSqlBuilder.class, method = "updateUserNicknameById")
    Integer updateUserNicknameById(String id,String nickname);



}